package com.zyz.K_集合.Map接口一HashMap.练习;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author: vick
 * @Date: 2025/3/30
 * @Description:
 * @version: 1.0
 */
public class Demo1 {
    public static void main(String[] args) {
        HashMap singers = new HashMap();

        String singer1 = "周董";
        ArrayList songs1 = new ArrayList();
        songs1.add("夜曲");
        songs1.add("稻香");
        songs1.add("青花瓷");
        songs1.add("晴天");

        //添加到map中
        singers.put(singer1, songs1);

        String singer2 = "邓紫棋";
        ArrayList songs2 = new ArrayList();
        songs2.add("喜欢你");
        songs2.add("光年之外");
        songs2.add("句号");
        songs2.add("倒数");

        //添加到map中
        singers.put(singer2, songs2);
        Set set = singers.entrySet();
        for (Object obj : set) {
            Map.Entry entry = (Map.Entry) obj;
            String key = (String)entry.getKey();
            ArrayList value = (ArrayList)entry.getValue();
            System.out.println("歌手：" + key);
            System.out.println("歌曲：" + value);
        }
    }
}
